package com.loyal.loyalerp.basedata.department.service;

import java.util.List;

import org.springframework.cache.annotation.Cacheable;

import com.github.pagehelper.PageInfo;
import com.loyal.loyalerp.basedata.department.entity.DepartmentNode;
import com.loyal.loyalerp.basedata.department.model.Department;
import com.loyal.loyalerp.basedata.department.model.DepartmentExample;
import com.loyal.loyalerp.model.GyPerson;
import com.loyal.loyalerp.model.form.GridSearchForm;
import com.loyal.loyalerp.model.vo.GridVO;

public interface DepartmentService {
	List<Department> list();

	PageInfo<Department> page(Integer pageNum, Integer pageSize);

	GridVO<Department> gridSearch(GridSearchForm form) throws Exception;

	boolean cud(String oper, Department department);

	DepartmentNode tree(Integer id);

	List<Department> getChildsById(Integer id);

	List<GyPerson> getPersonsById(Integer id);

	List<GyPerson> getPersonsByIds(List<Integer> ids);

	List<GyPerson> getPersonsByDepartments(List<Department> departments);

	long countByExample(DepartmentExample example);

	int deleteByCompanyId(Integer id);

	int deleteByExample(DepartmentExample example);

	int deleteByPrimaryKey(Integer id);

	int insert(Department record);

	int insertSelective(Department record);

	List<Department> selectByExample(DepartmentExample example);

	@Cacheable(value = "idSerializerCache", key = "#root.targetClass.getSimpleName()+'_'+#root.methodName+'_'+#id")
	Department selectByPrimaryKey(Integer id);

	int updateByExampleSelective(Department record, DepartmentExample example);

	int updateByExample(Department record, DepartmentExample example);

	int updateByPrimaryKeySelective(Department record);

	int updateByPrimaryKey(Department record);

	List<Department> selectByCompanyId(Integer id);

	Department selectByDeptname(String deptname);

}
